//
//  ChildNavigation.m
//  Wy_BuyBooks
//
//  Created by wangyang on 2020/2/6.
//  Copyright © 2020 wangyang. All rights reserved.
//

#import "ChildNavigation.h"

@interface ChildNavigation ()<UINavigationControllerDelegate>

@end

@implementation ChildNavigation

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    [self.navigationBar setTitleTextAttributes:
     @{NSFontAttributeName:[UIFont systemFontOfSize:18],
       NSForegroundColorAttributeName:WyBlackColor}];//导航栏字体颜色
    
   
    
    //设置状态栏颜色
    [self.navigationBar setBarStyle:UIBarStyleDefault];
    //设置导航栏颜色
    [self.navigationBar setBarTintColor:WyWhiteColor];
    [self.navigationBar setTranslucent:NO]; //关闭导航栏半透明效果
    //隐藏下划线
    [self.navigationBar setShadowImage:[UIImage new]];
    //左右颜色
    [self.navigationBar setTintColor:WyBlackColor];
    
    
    
    if(self.childViewControllers.count > 0) {
        
        viewController.hidesBottomBarWhenPushed = YES;
        viewController.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"flow备份"] style:UIBarButtonItemStylePlain target:self action:@selector(navigationBackClick)];
        viewController.navigationItem.rightBarButtonItem.tintColor = [UIColor grayColor];
        
    }
    [super pushViewController:viewController animated:animated];
    
    
    
    
}
- (void)navigationBackClick{
    
    
    [self popViewControllerAnimated:YES];
    
}
-(void)RightBack{
    [self popViewControllerAnimated:YES];
}
- (UIViewController*)popViewControllerAnimated:(BOOL)animated
{
    [super popViewControllerAnimated:YES];
    if (self.viewControllers.count==1) {
        self.tabBarController.tabBar.hidden=NO;
    }
    return self;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
